#include <iostream>
#include <cmath>
#include <ctime>
using namespace std;

#define RAND01 (rand()*1.0/RAND_MAX)

extern int modexp(int x, int y, int N);

bool primality(int N)
{
    srand(time(NULL));
    int a = int(1+RAND01*(N-1));
    if (modexp(a, N-1, N) == 1)
        return true;
    else
        return false;
}

void exam06(void)
{
    cout << primality(174) << endl;
}
